<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
</head>
<body>


    <script>
        function Draw (x , y) {
            this.x = "";
            this.y = "";
        }

        Draw.prototype.getRandom = function () {
            var num = Math.floor(Math.random()*150+50);
            var num1 =Math.floor(Math.random()*150+50);
            this.x = num ;
            this.y = num1;
            console.log(this.x); 
            console.log(this.y); 
        }
        var d1 = new Draw ();
        // console.log(d1.getRandom());

        function Rect (x1 , y1) {
            this.w = "";
            this.h = "";
            Draw.apply(this , [x1 , y1]);
            // console.log(this.x);
        }

        Rect.prototype.drawRect = function () {
            var num2 = Math.floor(Math.random()*150+50);
            var num3 = Math.floor(Math.random()*150+50);
            this.w = num2;
            this.h = num3;
            x1 = d1.num;
            y1 = d1.num1;
            console.log(this.w);
            console.log(this.h);
            console.log(x1);
            console.log(y1);
        }

        var d2 = new Rect();
        console.log(d2);
        console.log(d2.drawRect());

        function Circle(x2 , y2) {
            Draw.apply(this , [x2 , y2]);
        }

        Circle.prototype.drawCircle = function () {}
    </script>
</body>
</html>